package com.bh.order.vo;

import com.bh.common.annotation.Excel;
import com.bh.common.utils.StringUtils;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 订单对象 jc_order
 *
 * @author slx
 * @date 2023-04-22
 */
@Data
public class JcOrderImportVo implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotBlank(message = "发货单号不能为空")
    @Excel(name = "发货单号")
    private String relateBill1;

    public String getRelateBill1() {
        if (relateBill1 != null && StringUtils.isNotEmpty(relateBill1)) {
            return relateBill1.trim();
        }
        return relateBill1;
    }

    @Excel(name = "订单日期", prompt = "订单日期格式,例:2023/08/05")
    private Date time;

    private Integer handoverType = 1;

    @NotBlank(message = "入库区域不能为空")
    @Excel(name = "入库区域")
    private String zoneStoreroomName;

    @NotBlank(message = "出发网点不能为空")
    @Excel(name = "出发网点")
    private String jcOrganizationIdName;

    public String getJcOrganizationIdName() {
        if (jcOrganizationIdName != null && StringUtils.isNotEmpty(jcOrganizationIdName)) {
            return jcOrganizationIdName.trim();
        }
        return jcOrganizationIdName;
    }

    @NotBlank(message = "出发运点不能为空")
    @Excel(name = "出发运点", prompt = "必须是 昆明市,呈贡区(县),大渔街道(乡镇) 相似的格式，从 州市 一级开始，使用英文逗号隔开,如果地址是到乡镇，则必须到乡镇级别，数据参考 系统内行政区划")
    private String jcStartZoneIdName;

    public String getJcStartZoneIdName() {
        if (jcStartZoneIdName != null && StringUtils.isNotEmpty(jcStartZoneIdName)) {
            return jcStartZoneIdName.trim().replaceAll("，", ",");
        }
        return jcStartZoneIdName;
    }

    @NotNull(message = "计算方式不能为空")
    @Excel(name = "计算方式", prompt = "计算方式(0:按重量,1:按件数,2:按体积)", combo = {"0", "1", "2"})
    private Integer jsType;

    @NotBlank(message = "客户单号不能为空")
    @Excel(name = "客户单号")
    private String relateBill2;

    @NotNull(message = "客户类型不能为空")
    @Excel(name = "客户类型", prompt = "客户类型  0:零散，1:合同", combo = {"0", "1"})
    private Integer customerType;

    @NotBlank(message = "客户名称不能为空")
    @Excel(name = "客户名称")
    private String customerName;

    public String getCustomerName() {
        if (customerName != null && StringUtils.isNotEmpty(customerName)) {
            return customerName.trim();
        }
        return customerName;
    }

    @NotBlank(message = "发货联系人不能为空")
    @Excel(name = "发货联系人")
    private String fromContactperson;

    @NotBlank(message = "发货联系人电话不能为空")
    @Excel(name = "发货联系人电话")
    private String fromIphone;

    @NotNull(message = "货品类型不能为空")
    @Excel(name = "货品类型", prompt = "货品类型(1:药品,2:电器,3:服装,4:冷藏箱)", combo = {"1", "2", "3", "4"})
    private Integer productType;

    @NotBlank(message = "货品名称不能为空")
    @Excel(name = "货品名称")
    private String productName;

    @NotBlank(message = "货品包装不能为空")
    @Excel(name = "货品包装", prompt = "货品包装,0：纸箱、1：托盘、2：件、3：木桶、5：编织袋、6：卷、7：木箱、8：木架、9：无包装、10：铁桶、11：塑料桶、21:冷藏箱(20L),22:冷藏箱(60升),23:冷藏箱(61升以上)", combo = {"0", "1", "2", "3", "5", "6", "7", "8", "9", "10", "11", "21", "22", "23"})
    private String packageType;

    @NotNull(message = "货品数量不能为空")
    @Excel(name = "货品数量")
    private Integer productNumber;

    @NotBlank(message = "收货单位不能为空")
    @Excel(name = "收货单位")
    private String toCustomerName;

    public String getToCustomerName() {
        if (toCustomerName != null && StringUtils.isNotEmpty(toCustomerName)) {
            return toCustomerName.trim();
        }
        return toCustomerName;
    }


    @NotBlank(message = "收货电话不能为空")
    @Excel(name = "收货电话")
    private String toIphone;

    /**
     * 收货地址
     */
    @NotBlank(message = "收货地址不能为空")
    @Excel(name = "收货地址")
    private String toAddress;

    // 解析出的地址
    private String toStreetCode;


    @NotBlank(message = "目的网点不能为空")
    @Excel(name = "目的网点")
    private String jcToOrganizationIdName;

    public String getJcToOrganizationIdName() {
        if (jcToOrganizationIdName != null && StringUtils.isNotEmpty(jcToOrganizationIdName)) {
            return jcToOrganizationIdName.trim();
        }
        return jcToOrganizationIdName;
    }

    @NotBlank(message = "目的运点不能为空")
    @Excel(name = "目的运点", prompt = "必须是 昆明市,呈贡区(县),大渔街道(乡镇) 相似的格式，从 州市 一级开始，使用英文逗号隔开,如果地址是到乡镇，则必须到乡镇级别，数据参考 系统内行政区划")
    private String jcEndZoneIdName;


    public String getJcEndZoneIdName() {
        if (jcEndZoneIdName != null && StringUtils.isNotEmpty(jcEndZoneIdName)) {
            return jcEndZoneIdName.trim().replaceAll("，", ",");
        }
        return jcEndZoneIdName;
    }

    @NotBlank(message = "收货地址类型不能为空")
    @Excel(name = "收货地址类型", prompt = "发货地址类型(city:城区,villages:乡镇)", combo = {"city", "villages"})
    private String toAddressType = "city";


    @Excel(name = "货品体积")
    private BigDecimal productVolume = BigDecimal.ZERO;
    @Excel(name = "货品重量")
    private BigDecimal productWeight = BigDecimal.ZERO;

    private BigDecimal productValue = BigDecimal.ZERO;

    @Excel(name = "回单份数")
    private Integer backNumber;


    private String fromAddressType = "city";
    private String fromLtl;
    private Integer feeType = 0;
    private Integer transportPro = 0;
    private Integer shipmentMethod = 0;
}
